console.log(location.href)
    let url = location.search;
    // let url="?categoryid=0&productid=1"
    console.log(url)


fetch("http://chst.vip:1234/api/getproduct"+url)
.then(body => body.json())
.then(res => {
console.log(res);
let html = ""
res.result.forEach(item => {
    html +=
    `
    <a href="../index.html">首页></a> 
    <span></span>
    <a href="">${item.productName.slice(0,2)}</a>
    <a href="#">筛选</a>
    
    `
    let htmll = document.querySelector("#nav")
htmll.innerHTML=html
fetch("http://chst.vip:1234/api/getcategorybyid?categoryid="+item.categoryId)
.then(bodyy => bodyy.json())
.then(ress => {
    console.log(ress);
    let html = ""
    ress.result.forEach(item => {
        html+=
        `<a href="../page/bijia.html/?title=${item.category}&categoryid=${item.categoryId}">${item.category}></a>`
    })
    let a =document.querySelector("#nav span")
    a.innerHTML = html
})
})
res.result.forEach(item => {
    console.log(item.bjShop);
    let html = ""
    html += 
    `
    <div class="info">
        <div class="pic">${item.productImg}</div>
        <div class="title">${item.productName}</div>
        <div class="wqjg">
           <div class="zuidil">
             <span>当前最低</span>
             <span>￥6000</span>
           </div>
          <div class="zuidir">
             <span>优选评论</span>
             <span>8266条</span>
          </div>   
        </div>
    </div>
    ${item.bjShop}
    <div class="comment"><h4>网友评价</h4><div class="comment-pin"></div></div>
    

    `
    let main = document.querySelector("main")
    main.innerHTML=html
})
fetch("http://chst.vip:1234/api/getproductcom?productid="+res.result[0].productId)
.then(bodyy => bodyy.json())
.then(ress => {
    let httml =""
    ress.result.forEach(item => {
        httml += 
        `<div class="box">
           <div class="wyname">
              <span>${item.comName}</span>
              <span>${item.comTime}</span>
           </div>
           <div class="neirong">${item.comContent}</div>
           <div class="pingtai">${item.comFrom}</div>
           </div>
        `
    })
    let html =document.querySelector("main .comment-pin")
    html.innerHTML+=httml
})




















})